/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package be.ugent.medirem.persistence.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

/**
 *
 * @author Thomas Roelens <thomas.roelens@ugent.be>
 */
@Entity
@NamedQueries({
    @NamedQuery(name = "GeneralPractitioner.GetId",
    query = "SELECT gp.id FROM GeneralPractitioner gp WHERE gp.username = :username")
})
public class GeneralPractitioner extends Account implements Serializable {

    private static final String ROLE = "gp";
    @ManyToMany
    private Collection<Patient> patients;

    public GeneralPractitioner() {
        super.setRolename(ROLE);
    }

    public GeneralPractitioner(String username, String password, String firstname, String surname) {
        super(username, password, ROLE, firstname, surname);
    }

    public GeneralPractitioner(String username, String password, String firstname, String surname, Location location) {
        super(username, password, ROLE, firstname, surname, location);
    }

    public Collection<Patient> getPatients() {
        return patients;
    }

    public void setPatients(Collection<Patient> patients) {
        this.patients = patients;
    }

    public void addPatient(Patient patient) {
        this.patients.add(patient);
    }
}
